Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change operator precedence to be left biased. #2685

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SanderSpies
Copy link
Contributor

@SanderSpies SanderSpies commented Feb 27, 2023

Make &, &&, |, ||, ++, and :: operators left associative.

The tradeoff here is between JS and OCaml.

Here’s the precedence list of JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#table

and here of OCaml:
https://v2.ocaml.org/api/Ocaml_operators.html

The important difference here is:

&, &&, |, ||, ^, :: right associative in OCaml (and current ReasonML default)
&, &&, |, ||, + left associative in JS. :: is obviously not present in JS and I decided to make that left associative as well as it “feels” more correct here.

See also: #2672

@SanderSpies SanderSpies changed the title wip: Change operator precedence to be left biased. Change operator precedence to be left biased. Mar 6, 2023
@SanderSpies SanderSpies marked this pull request as ready for review March 6, 2023 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant